package com.cskaoyan.controller.promote.exception;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.promote.exception.*;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author liXiaoFei
 * @date 2021/10/18 20:52
 */
@RestControllerAdvice
public class AdvertisingExceptionControllerAdvice {

    @ExceptionHandler(AddAdvertisingException.class)
    public BaseRespVo addAdvertisingException(){
        return BaseRespVo.error("添加广告失败");
    }

    @ExceptionHandler(UpdateAdvertisingException.class)
    public BaseRespVo updateAdvertisingException(){
        return BaseRespVo.error("更新广告失败");
    }

    @ExceptionHandler(DeleteAdvertisingException.class)
    public BaseRespVo deleteAdvertisingException(){
        return BaseRespVo.error("删除广告失败");
    }

    @ExceptionHandler(AddCouponException.class)
    public BaseRespVo addCouponException(){
        return BaseRespVo.error("添加优惠券失败");
    }

    @ExceptionHandler(GetCouponException.class)
    public BaseRespVo getCouponException(){
        return BaseRespVo.error("优惠券显示失败");
    }

    @ExceptionHandler(UpdateCouponException.class)
    public BaseRespVo updateCouponException(){
        return BaseRespVo.error("优惠券编辑失败");
    }

    @ExceptionHandler(AddTopicException.class)
    public BaseRespVo addTopicException(){
        return BaseRespVo.error("添加专题失败");
    }

    @ExceptionHandler(DeleteTopicException.class)
    public BaseRespVo deleteTopicException(){
        return BaseRespVo.error("删除专题失败");
    }

    @ExceptionHandler(EchoUpdateTopicException.class)
    public BaseRespVo echoUpdateTopicException(){
        return BaseRespVo.error("显示专题出现错误");
    }

    @ExceptionHandler(UpdateTopicException.class)
    public BaseRespVo updateTopicException(){
        return BaseRespVo.error("修改专题失败");
    }
}
